"use strict";
cc._RF.push(module, 'eb7db4kM8pLTpNxj3OB5Wso', 'WeaponSaw');
// scripts/WeaponSaw.js

"use strict";

var t = require;
var e = module;
var o = exports;

var _i,
    n = void 0 && (void 0).__extends || (_i = function i(t, e) {
  return (_i = Object.setPrototypeOf || {
    __proto__: []
  } instanceof Array && function (t, e) {
    t.__proto__ = e;
  } || function (t, e) {
    for (var o in e) {
      Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
    }
  })(t, e);
}, function (t, e) {
  function o() {
    this.constructor = t;
  }

  _i(t, e), t.prototype = null === e ? Object.create(e) : (o.prototype = e.prototype, new o());
}),
    a = void 0 && (void 0).__decorate || function (t, e, o, i) {
  var n,
      a = arguments.length,
      r = a < 3 ? e : null === i ? i = Object.getOwnPropertyDescriptor(e, o) : i;
  if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, o, i);else for (var s = t.length - 1; s >= 0; s--) {
    (n = t[s]) && (r = (a < 3 ? n(r) : a > 3 ? n(e, o, r) : n(e, o)) || r);
  }
  return a > 3 && r && Object.defineProperty(e, o, r), r;
};

Object.defineProperty(o, "__esModule", {
  value: !0
});

var r = t("GameConstant"),
    s = t("BroadCastMessage"),
    l = t("Util"),
    c = cc._decorator,
    d = c.ccclass,
    h = c.property,
    p = function (t) {
  function e() {
    var e = null !== t && t.apply(this, arguments) || this;
    return e.spine = null, e.collider = null, e.animation = null, e.sp_effect = null, e.isGameOver = !1, e.damageNum = 0, e.bCanAttack = !0, e.nAudioId = null, e;
  }

  return n(e, t), e.prototype.init = function (t, e, o, i) {
    this.collider.tag = e, this.sp_effect.node.active = !1, this.isGameOver = !1, this.damageNum = o, t == r.Collide_Car_Tag.Left ? (this.node.scaleX = 1, this.node.position = i) : (this.node.scaleX = -1, this.node.position = cc.v3(-i.x, i.y, i.z));
  }, e.prototype.onGameStart = function () {}, e.prototype.onGameOver = function () {
    this.isGameOver = !0, this.sp_effect.node.active = !1, this.spine.paused = !0, this.animation.stop();
  }, e.prototype.onGameBoutReady = function () {
    this.sp_effect.node.active = !1, this.node.active = !1, this.destroy();
  }, e.prototype.onGameBoutStart = function () {
    this.node.active = !0, this.sp_effect.node.active = !1, this.isGameOver = !1, this.spine.paused = !1, this.spine.setAnimation(0, "animation", !0), this.animation.play();
  }, e.prototype.onGameBoutOver = function () {
    this.isGameOver = !0, this.leaveOtherCar(), this.animation.stop();
  }, e.prototype.onCanAttack = function (t) {
    this.bCanAttack = t, t ? (this.spine.paused = !1, this.spine.setAnimation(0, "animation", !0), this.animation.play()) : (this.spine.paused = !0, this.animation.stop(), this.leaveOtherCar());
  }, e.prototype.playEffect = function () {
    var t = this;
    this.bCanAttack && (this.isGameOver || (this.sp_effect.node.active = !0, this.sp_effect.setAnimation(0, "animation", !1), this.scheduleOnce(function () {
      t.sp_effect.node.active = !1;
    }, 2.4)));
  }, e.prototype.leaveOtherCar = function () {
    this.nAudioId && s["default"].getInstance().SendMessage(r.Game_Broadcast_Func.stopAudio, this.nAudioId), this.sp_effect.node.active = !1, this.spine.paused = !0;
  }, e.prototype.getDamage = function () {
    return this.bCanAttack ? (this.nAudioId = s["default"].getInstance().SendMessage(r.Game_Broadcast_Func.Audio, r.Game_Audio_ID.spin_loop), l.Util.vibrateMiddle(), this.damageNum) : 0;
  }, a([h(sp.Skeleton)], e.prototype, "spine", void 0), a([h(cc.Collider)], e.prototype, "collider", void 0), a([h(cc.Animation)], e.prototype, "animation", void 0), a([h(sp.Skeleton)], e.prototype, "sp_effect", void 0), a([d], e);
}(cc.Component);

o["default"] = p;

cc._RF.pop();